import { nanoid } from "nanoid";

export default function getUserTempId() {
  let userTempId = localStorage.getItem("userTempId");
  //首先判断用户的本地是否存储有临时id
  if (!userTempId) {
    //如果没有则调用nanoid获取临时证明
    let userTempId = nanoid();
    //获取完新的证明之后,直接在本地中再次保存
    localStorage.setItem("userTempId", userTempId);
  }
  return userTempId;
}
